<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" >
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <?php $this->load->view('head'); ?>
            <link type="text/css" href="<?php echo base_url() . "css/redmond/jquery-ui-1.8.14.custom.css"; ?>" rel="stylesheet" />
            <script src="<?php echo base_url() . "js/jquery-ui-1.8.14.custom.min.js"; ?>" type="text/javascript"></script>
            <script src="<?php echo base_url() . "js/jquery.ui.datepicker-es.js" ?>" type="text/javascript"></script>
            <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url() . "css/ui.jqgrid.css" ?>" />
            <script src="<?php echo base_url() . "js/i18n/grid.locale-es.js" ?>" type="text/javascript"></script>
            <script src="<?php echo base_url() . "js/jquery.jqGrid.min.js" ?>"  type="text/javascript"></script>
            <style type="text/css">
                .claseno{color:red}
                .btnEnGrilla{ font-weight: bolder;font-style: italic;font-size: 9px;padding: 1px 2px;}
                .btnEnGrillaElimina{ font-weight: bolder;font-style: italic;font-size: 9px;padding: 1px 2px;color:red;}
            </style>
            <title></title>
            <script type="text/javascript">
                $(document).ready(function(){
                    $("#btnConsultar").button();
                    jQuery("#list").jqGrid({
                        url: '<?php echo site_url("grilla/consultaInstiCiuServicios/"); ?>',
                        datatype: 'json',
                        mtype: 'POST',
                        colNames:['Accion','Nombre'],
                        colModel :[
                            {name:'postu',index:'postu', width:110,align:'center'},
                            {name:'institucionNit',index:'institucionNit', width:450}
                        ],
                        loadComplete: function(){
                            var ids = jQuery("#list").getDataIDs();
                            for(var i=0;i < ids.length;i++){
                                var cl = ids[i];
                                var se = "<input type='button' onclick=\"fnSolicita('" + cl + "')\" tittle='Solicitar Servicio' value='Contactar' />";
                                jQuery("#list").setRowData(cl,{postu:se});
                            }
                        },
                        pager: jQuery('#pager'),
                        rowNum:50,
                        postData: {
                            servicios: function() {
                                var txtservicios = "";
                                $("#divCheboxServicios > :checkbox").each(function(){
                                    if($(this).is(":checked")){
                                        txtservicios = txtservicios + "," + $(this).val();
                                    }
                                }); //fin $("#divCheboxServicios > :checkbox").each(function(){
                                return txtservicios; 
                            }
                        },
                        rowList:[10,20,30,50],
                        sortname: 'insti.institucionRazon',
                        sortorder: "asc",
                        viewrecords: true,
                        caption: 'INSTITUCIONES',
                        height:260
                    });
                    //Barra de navegación
                    jQuery("#list").jqGrid('navGrid','#pager',{del:false,add:false,edit:false,view:true},{},{},{},{multipleSearch:true},{closeOnEscape:true});
                
                    $("#btnConsultar").click(function(){
                        var ban = false;
                        $("#divCheboxServicios > :checkbox").each(function(){
                            if($(this).is(":checked")){
                                ban = true;
                            }
                        }); //fin $("#divCheboxServicios > :checkbox").each(function(){
                        if(!ban){
                            alert("Debe elegir minímo un servicio para consultar");
                            return false;
                        }
                        jQuery("#list").trigger("reloadGrid");                        
                    });
<?php $this->load->view('enReady'); ?>
    }); //fin $(document).ready(function(){
    function fnSolicita(insti){
        window.open("<?php echo site_url("empresa/consInstitucion/") . "/"; ?>" + insti + "/Si", "Instituciones", "width=1300,height=500,scrollbars=YES");
    }
            </script>
    </head>
    <body>
        <script src="<?php echo base_url() . "js/wz_tooltip-min.js" ?>" type="text/javascript"></script>
        <div class="divTitulo">CONSULTA SERVICIOS Y/O ASESORIAS EN LA CIUDAD</div>
        <form id="formServicio" method="POST">
            <div style="text-align: left" ><label >Elija los servicios que desee consultar</label></div>
            <div id="divCheboxServicios" style="width: 500px;text-align: left" class="divChecbox" >
                <?php
                foreach ($serviciosInclu->result() as $servi) {
                    echo "<input type='checkbox' value='{$servi->servInclusionId}' id='{$servi->servInclusionId}' name='formacion[]' /><label for='{$servi->servInclusionId}' onmouseover=\"Tip('" . preg_replace("[\n|\r|\n\r]", ' ', $servi->serviInclusionDescrib) . "', SHADOW, true,'' , '', PADDING, 9);\" onmouseout=\"UnTip()\">$servi->servInclusionNombre</label><br/>";
                }
                ?>
            </div>
            <div style="text-align: left">
                <input type="button" value="Consultar" id="btnConsultar" />
            </div>
        </form>
        <div id="pager" class="scroll"></div>
        <table id="list" class="scroll"></table>
    </body>
</html>
